﻿using Microsoft.Extensions.DependencyInjection;
using Modules.Person.Repositories;
using PmSoft;

namespace Modules.Person;

[UseDI(ServiceLifetime.Scoped)]
public class PersonCertificateSpecialityService
{
    private readonly PersonCertificateSpecialityRepository personCertificateSpecialityRepository;

    public PersonCertificateSpecialityService(PersonCertificateSpecialityRepository personCertificateSpecialityRepository)
    {
        this.personCertificateSpecialityRepository = personCertificateSpecialityRepository;
    }

    public IEnumerable<PersonCertificateSpeciality> GetPersonCertificateSpecialitysByCetificteIds(IEnumerable<string> cetificteIds)
    {
        return personCertificateSpecialityRepository.GetPersonCertificateSpecialitysByCetificteIds(cetificteIds);
    }

    public IEnumerable<PersonCertificateSpeciality> GetPersonCertificateSpecialitysByCetificteId(string cetificteId)
    {
        return personCertificateSpecialityRepository.GetPersonCertificateSpecialitysByCetificteId(cetificteId);
    }

    public void Create(PersonCertificateSpeciality entity)
    {
        personCertificateSpecialityRepository.Insert(entity);
    }

    public void Deleted(IEnumerable<string> ids)
    {
        foreach (var id in ids)
        {
            Delete(id);
        }
    }

    public void Delete(string id)
    {
        personCertificateSpecialityRepository.DeleteByEntityId(id);
    }
}